﻿<Border xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="Caffeine.Examples.Contacts.View.ContactView"
        xmlns:contacts="clr-namespace:Caffeine.Examples.Contacts.ViewModel"
        xmlns:contactViews="clr-namespace:Caffeine.Examples.Contacts.View">
    <TabControl>
        <TabItem Header="Addresses">
            <Grid Margin="0,0,10,0" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Button ToolTip="Add Address" 
                        HorizontalAlignment="Left" 
                        Command="{Binding AddAddress}" 
                        Style="{StaticResource AddButton}" 
                        Margin="0,10,0,10" />
                <ScrollViewer Grid.Row="1" Margin="0,0,5,2" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                    <ItemsControl ItemsSource="{Binding Addresses}">
                        <ItemsControl.Resources>
                            <DataTemplate DataType="{x:Type contacts:AddressViewModel}">
                                <Grid Margin="0,4,0,0" HorizontalAlignment="Left">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <contactViews:AddressView HorizontalAlignment="Left" Margin="0,0,5,15" />
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.Resources>
                    </ItemsControl>
                </ScrollViewer>
            </Grid>
        </TabItem>
        <TabItem Header="Removed Addresses">
            <StackPanel Margin="0,0,10,0">
                <ScrollViewer>
                    <ItemsControl ItemsSource="{Binding Addresses.RemovedViewModels}">
                        <ItemsControl.Resources>
                            <DataTemplate DataType="{x:Type contacts:AddressViewModel}">
                                <StackPanel Margin="0,4,0,0">
                                    <contactViews:AddressView />
                                </StackPanel>
                            </DataTemplate>
                        </ItemsControl.Resources>
                    </ItemsControl>
                </ScrollViewer>
            </StackPanel>
        </TabItem>
        <TabItem Header="New Addresses">
            <StackPanel Margin="0,0,10,0">
                <ItemsControl ItemsSource="{Binding AddedAddressViewModels}">
                    <ItemsControl.Resources>
                        <DataTemplate DataType="{x:Type contacts:AddressViewModel}">
                            <StackPanel Margin="0,4,0,0">
                                <contactViews:AddressView />
                            </StackPanel>
                        </DataTemplate>
                    </ItemsControl.Resources>
                </ItemsControl>
            </StackPanel>
        </TabItem>
    </TabControl>
</Border>

